package com.inossem.warehousestorage_inossem.request.analysis;

import android.content.Context;

import com.google.gson.Gson;
import com.inossem.warehousestorage_inossem.bean.analysis.AnalysisWorkStatisticsChartBean;
import com.inossem.warehousestorage_inossem.bean.analysis.AnalysisWorkStatisticsRequestBean;
import com.inossem.warehousestorage_inossem.constant.RequestConstant;
import com.inossem.warehousestorage_inossem.listener.GsonBeanListener;
import com.inossem.warehousestorage_inossem.listener.StringRequestListener;
import com.inossem.warehousestorage_inossem.manage.RequestManage;
import com.inossem.warehousestorage_inossem.model.StringResponse;
import com.inossem.warehousestorage_inossem.request.Request;

/**
 * Created by leij on 2017/6/12.
 */

public class AnalysisWorkStatisticsGetChartRequest extends Request {

    public static String request(Context context, AnalysisWorkStatisticsRequestBean paramsBean, GsonBeanListener gsonBeanListener) {
        String tag;
        String url = RequestManage.getUrl(context, RequestConstant.URL_ANALYSIS_WORKSTATISTICS_GET_CHART);
        Gson gson = new Gson();
        String params = gson.toJson(paramsBean, paramsBean.getClass());
        int method = com.android.volley.Request.Method.POST;
        tag = RequestManage.requestHttpsJsonObjectWithLoading(context, method, url, params, new StringRequestListener() {
            @Override
            public void onSuccess(StringResponse stringRequestResponse) {
                Gson gson = new Gson();
                AnalysisWorkStatisticsChartBean bean = gson.fromJson(stringRequestResponse.getResponseInfo(), AnalysisWorkStatisticsChartBean.class);
                excuteJsonBean(context, bean, bean.getCode(), bean.getMsg(), gsonBeanListener);
            }
        });
        return tag;
    }

}
